package com.pets.controller;


import com.pets.pojo.EquipmentManagement;
import com.pets.pojo.FeedbackManagement;
import com.pets.service.IFeedbackManagementService;
import com.pets.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 反馈管理 前端控制器
 * </p>
 *
 * @author 小陳同學
 * @since 2024-05-13
 */
@RestController
@RequestMapping("/feedback-management")
@Api(tags = "反馈管理")
public class FeedbackManagementController {

    @Autowired
    private IFeedbackManagementService feedbackManagementService;

    @ApiOperation("添加反馈")
    @PostMapping
    public Result register(@RequestBody FeedbackManagement feedbackManagement) {
        return feedbackManagementService.register(feedbackManagement);
    }

    @ApiOperation("根据id删除反馈")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        return feedbackManagementService.deleteById(id);
    }

    @ApiOperation("查询反馈分页集合")
    @GetMapping("/list")
    public Result list(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer pageSize,
                       @ApiParam(value = "当前登陆人id（管理员与教练不用传,在首页不用传）")@RequestParam(required = false) Integer userId) {
        return feedbackManagementService.selectPage(page, pageSize, userId);
    }
}
